package text;

/**
 * Created with IntelliJ IDEA.
 * Description:
 */
class Findmax1 <T extends Comparable<T>>{
    public T findMax(T[] array){
        T max =array[0];
        for (int i = 0; i < array.length; i++) {
            if (array[i].compareTo(max)>0){
                max =array[i];
            }
        }
        return max;
    }
}
class Findmax{
    public static  <T extends Comparable<T>> T findMax(T[] array){
        T max =array[0];
        for (int i = 0; i < array.length; i++) {
            if (array[i].compareTo(max)>0){
                max =array[i];
            }
        }
        return max;
    }
}
public class Text2 {
    public static void main(String[] args) {
        Integer[] array1 =new Integer[]{34,2,54,12};
        String[]  array2 =new String[]{"zhangsang","lishi","aa"};
        System.out.println(Findmax.findMax(array1));
        System.out.println(Findmax.findMax(array2));
    }
}
